<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:composition template="/template/_template.xhtml">
      <ui:define name="conteudo">
      <h:form>
      <h:messages/>
     	<h:dataTable  value="#{alunoBean.listaAlunos}" var="aluno" rules="rows" cellpadding="5">
     	<f:facet name="caption">
     	A listagem a seguir exibe a relação de todos os alunos do sistema.
     	</f:facet>
     	<f:facet name="header">Listagem de Alunos</f:facet>
     	<f:facet name="footer">Final da Listagem de Alunos</f:facet>
     	<h:column>
     	<f:facet name="header">Matricula</f:facet>
     	#{aluno.matricula}
     	</h:column>
     	<h:column>
     	<f:facet name="header">CPF</f:facet>
     	#{aluno.cpf}
     	</h:column>
     	<h:column>
     	<f:facet name="header">Nome</f:facet>
     	#{aluno.nome}
     	</h:column>
     	<h:column>
     	<f:facet name="header">Data Nascimento</f:facet>
     	<h:outputText value="#{aluno.dataNascimento.time}">
     	<f:convertDateTime pattern="dd/MM/yyyy" timeZone="America/Sao_Paulo"/>
     	</h:outputText>
     	</h:column>
     	<h:column>
     	<f:facet name="header">Sexo</f:facet>
     	<h:graphicImage library="img" name="#{aluno.sexo}.png" style="border:0"/>
     	</h:column>
     	<h:column>
     	<h:commandLink action="#{alunoBean.editar}" >
     	<h:graphicImage library="img" name="editar.png" style="border:0"/>
     	<f:setPropertyActionListener target="#{alunoBean.aluno}" value="#{aluno}"/>
     	</h:commandLink>
     	</h:column>
     	<h:column>
     	<h:commandLink action="#{alunoBean.excluirAluno}" onclick="if(!confirm('Confirma a exclusão do aluno #{aluno.nome}?')) return false;">
     	<h:graphicImage library="img" name="excluir.png" style="border:0"/>
     	<f:setPropertyActionListener target="#{alunoBean.aluno}" value="#{aluno}"/>
     	</h:commandLink>
     	</h:column>
     	</h:dataTable>
      </h:form>
      </ui:define>
     </ui:composition>
</html>